package com.bawei.park2211a.person

import androidx.lifecycle.MutableLiveData
import com.bawei.base.bean.DepartmentEntity
import com.bawei.base.bean.DepartmentPersonNumberEntity
import com.bawei.base.bean.PersonListEntity
import com.bawei.base.mvvm.BaseViewModel
import com.bawei.base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class PersonViewModel @Inject constructor(var apiService: ApiService):BaseViewModel() {
    val personListSuccess=MutableLiveData<MutableList<PersonListEntity>>()
    var departmentSuccess=MutableLiveData<MutableList<DepartmentEntity>>()
    var departmentPersonNumberSuccess=MutableLiveData<MutableList<DepartmentPersonNumberEntity>>()
    fun personList(){
        httpRequest({apiService.personList()},{personListSuccess.postValue(it)})
    }
    fun departmentList(){
        httpRequest({apiService.departmentList()},{departmentSuccess.postValue(it)})
    }
    fun departmentPersonNumber(id:Int){
        httpRequest({apiService.departmentPersonNumber(id)},{departmentPersonNumberSuccess.postValue(it)})
    }
}